#region Copyright RenGuiYou. All rights reserved.
//=====================================================
// NeatlyFrameWork
// Author:      RenGuiyou
// Feedback: 	mailto:750539605@qq.com
//=====================================================
#endregion

using System;
using System.Text;

public static class SystemExtends
{
    #region string
    public static string ReplaceEmpty(this string source, string oldVlue)
    {
        return source.Replace(oldVlue, string.Empty);
    }

    public static string StandardPath(this string source)
    {
        return source.Replace("\\", "/").ToLower();
    }

    public static string ReplacePath(this string source, string oldValue, string newValue)
    {
        return source.StandardPath().Replace(oldValue.StandardPath(), newValue);
    }

    public static string SubstringTo(this string source, string value)
    {
        int index = source.IndexOf(value, StringComparison.Ordinal);
        if (index == -1) return source;
        return source.Substring(0, index);
    }

    public static string GetFileName(this string source)
    {
        string[] array = source.StandardPath().Split('/');
        return array[array.Length - 1];
    }
    #endregion

    public static void Clear(this StringBuilder sb)
    {
        sb.Length = 0;
    }
    public static void AppendLineEx(this StringBuilder sb, string str = "")
    {
        sb.Append(str + "\r\n");
    }

}
